<?php namespace App\Models;

class Page extends \Eloquent {
	protected $table = 'pages';
	protected $softDelete = true;
 
    public function author()
    {
        return $this->belongsTo('User');
    }

    public static function getMaxPageOrder()
    {
        return \DB::table('pages')->max("pageorder");
    }

	public function rows()
	{
		return $this->hasMany("App\Models\PageRow", "pageid");
	}

	public function template()
	{
		return $this->hasOne("App\Models\PageTemplate", "id", "pagetemplateid")->first();
	}
}